//
// Created by leisurexi on 12/6/20.
// stdcpy.c
//
#include <stdio.h>
#include <unistd.h>
#include <time.h>

#define BUF_SIZE 3

int main(int argc, char *argv[]) {
    FILE *fp1, *fp2;
    char buf[BUF_SIZE];
    clock_t start, end;

    fp1 = fopen("/home/leisurexi/Documents/news.txt", "r");
    fp2 = fopen("/home/leisurexi/Documents/cpy.txt", "w");

    start = clock();
    while (fgets(buf, BUF_SIZE, fp1) != NULL)
        fputs(buf, fp2);
    end = clock();
    printf("time=%f\n", ((double) end - start));

    fclose(fp1);
    fclose(fp2);
    return 0;
}
